package com.base.pojo;

import java.util.Objects;

/**
 * this is a class demo.
 *
 * @author pretty_boy
 * @date 2018/9/26 16:16
 */
public class Apple extends Fruit {
    enum Color {RED, BLUE, YELLOW}

    Color color;
    private Integer weight;

    public Apple(Integer weight) {
        this.weight = weight;
    }

    public Apple() {
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Apple apple = (Apple) o;
        return color == apple.color &&
                Objects.equals(weight, apple.weight);
    }

    @Override
    public int hashCode() {
        return Objects.hash(color, weight);
    }

    @Override
    public String toString() {
        return "Apple{" +
                "color=" + color +
                ", weight=" + weight +
                '}';
    }
}
